import QtQuick
import QtQuick.Controls

Rectangle {
    color: "lightgray"

    Column {
        anchors.centerIn: parent
        spacing: 10

        Button {
            text: "延迟加载"
            onClicked: {
                busyIndicator.running = true
                delayTimer.start()
            }
            anchors.horizontalCenter: parent.horizontalCenter
        }

        BusyIndicator {
            id: busyIndicator
            running: false
            anchors.horizontalCenter: parent.horizontalCenter
        }

        Loader {
            id: loader
            width: 200
            height: 200
            anchors.horizontalCenter: parent.horizontalCenter
        }
    }

    Timer {
        id: delayTimer
        interval: 2000  // 延迟2秒加载
        onTriggered: {
            loader.source = "component/HeavyComponent.qml"
            busyIndicator.running = false
        }
    }
}
